#pragma once

namespace xyl {
	template<class T, class Container = std::list<T>>
	class stack {
	public:
		void push(const T& val) {c.push_back(val);}
		void pop() {c.pop_back();}
		T& top() {return c.back();}
		const T& top() const {return c.back();}
		size_t size() const {return c.size();}
		bool empty() const {return c.empty();}
	private:
		Container c;
	};


	void test_stack() {
		stack<int> st;
		st.push(1);
		st.push(2);
		st.push(3);
		st.push(4);
		while (!st.empty()) {
			cout << st.top() << ' ';
			st.pop();
		}
		cout << endl;
	}

}